﻿
namespace MyFurion.Application.Dtos
{
    /// <summary>
    /// 用户查询条件
    /// </summary>
    public class UserInfoPage:PageBaseInput
    {
        /// <summary>
        /// 机构名称
        /// </summary>
        public string OrgName { get; set; }
        /// <summary>
        /// 昵称
        /// </summary>
        public string NickName { get; set; }
        /// <summary>
        /// 用户姓名
        /// </summary>
        public string UserName { get; set; }
    }
    /// <summary>
    /// 用户新增信息
    /// </summary>
    public class UserInfoAdd
    {
        /// <summary>
        /// 用户姓名
        /// </summary>
        [Required(ErrorMessage = "用户姓名不能为空")]
        public string UserName { get; set; } = string.Empty;
        /// <summary>
        /// 用户昵称
        /// </summary>
        public string NickName { get; set; }
        /// <summary>
        /// 登录账户
        /// </summary>
        [Required(ErrorMessage = "登录账户不能为空")]
        public string Account { get; set; } = string.Empty;
        /// <summary>
        /// 登录密码
        /// </summary>
        [Required(ErrorMessage = "登录密码不能为空")]
        [MinLength(8,ErrorMessage ="登录密码长度至少8位")]
        [RegularExpression(pattern: @"^(?:(?=.*[0-9].*)(?=.*[A-Za-z].*)(?=.*[^0-9A-Za-z].*)).{3,}", ErrorMessage = "登录密码应包含字母、数字及符号")]
        public string LoginPwd { get; set; } = string.Empty;
        /// <summary>
        /// 联系电话
        /// </summary>
        public string Tel { get; set; }
        /// <summary>
        /// 电子邮箱
        /// </summary>
        public string Email { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        [Required(ErrorMessage = "状态不能为空")]
        public EnumStatus Status { get; set; }
        /// <summary>
        /// 组织机构id
        /// </summary>
        [Required(ErrorMessage = "组织机构id不能为空")]
        public long OrgId { get; set; }
        /// <summary>
        /// 关联角色
        /// </summary>
        public List<long> RoleIds { get; set; } = new();
    }

    /// <summary>
    /// 用户更新信息
    /// </summary>
    public class UserInfoUpdate
    {
        /// <summary>
        /// id
        /// </summary>
        public long Id { get; set; }
        /// <summary>
        /// 用户姓名
        /// </summary>
        [Required(ErrorMessage = "用户姓名不能为空")]
        public string UserName { get; set; } = string.Empty;
        /// <summary>
        /// 用户昵称
        /// </summary>
        public string NickName { get; set; }
        /// <summary>
        /// 登录账户
        /// </summary>
        [Required(ErrorMessage = "登录账户不能为空")]
        public string Account { get; set; } = string.Empty;
        /// <summary>
        /// 联系电话
        /// </summary>
        public string Tel { get; set; }
        /// <summary>
        /// 电子邮箱
        /// </summary>
        public string Email { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        [Required(ErrorMessage = "状态不能为空")]
        public EnumStatus Status { get; set; }
        /// <summary>
        /// 组织机构id
        /// </summary>
        [Required(ErrorMessage = "组织机构id不能为空")]
        public long OrgId { get; set; }
        /// <summary>
        /// 关联角色
        /// </summary>
        public List<long> RoleIds { get; set; } = new();
    }
    /// <summary>
    /// 修改密码
    /// </summary>
    public class ModifyPasswordInput
    {
        /// <summary>
        /// id
        /// </summary>
        public long Id { get; set; }
        /// <summary>
        /// 旧密码
        /// </summary>
        [Required(ErrorMessage = "旧密码不能为空")]
        public string OldPassword { get; set; } = string.Empty;
        /// <summary>
        /// 新密码
        /// </summary>
        [Required(ErrorMessage = "新密码不能为空")]
        [MinLength(8, ErrorMessage = "新密码长度至少8位")]
        [RegularExpression(pattern: @"^(?:(?=.*[0-9].*)(?=.*[A-Za-z].*)(?=.*[^0-9A-Za-z].*)).{3,}", ErrorMessage = "新密码应包含字母、数字及符号")]
        public string NewPassword { get; set; } = string.Empty;
    }
    /// <summary>
    /// 重置密码
    /// </summary>
    public class ResetPwdInput
    {
        /// <summary>
        /// id
        /// </summary>
        public long Id { get; set; }
    }
}
